package io.renren.modules.reception.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.reception.entity.vo.CountTotalVo;
import io.renren.modules.store.entity.vo.FoodDiscountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.reception.dao.TStoreFastfoodRecordDao;
import io.renren.modules.reception.entity.TStoreFastfoodRecordEntity;
import io.renren.modules.reception.service.TStoreFastfoodRecordService;


@Service("tStoreFastfoodRecordService")
public class TStoreFastfoodRecordServiceImpl extends ServiceImpl<TStoreFastfoodRecordDao, TStoreFastfoodRecordEntity> implements TStoreFastfoodRecordService {

    @Autowired
    private TStoreFastfoodRecordDao fastfoodRecordDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreFastfoodRecordEntity> page = this.page(
                new Query<TStoreFastfoodRecordEntity>().getPage(params),
                new QueryWrapper<TStoreFastfoodRecordEntity>()
                .eq(params.get("status") != null , "status",params.get("status"))
        );

        return new PageUtils(page);
    }

    @Override
    public Page<TStoreFastfoodRecordEntity> listFastFood(Map<String, Object> params) {
        Page<TStoreFastfoodRecordEntity> page = new Page<TStoreFastfoodRecordEntity>
                (Long.parseLong((String) params.get("current")),Long.parseLong((String) params.get("size")));
        return fastfoodRecordDao.listFastFood(page,params);
    }

    @Override
    public List<CountTotalVo> sumReallyGet(Map<String, Object> map) {
        return fastfoodRecordDao.sumReallyGet(map);
    }

}